<template>
  <div>
    <div class="cinema">
      <div class="tab">
        <div class="item">
          全城<span class="iconfont icon-xiala"></span
          ><span class="iconfont icon-vertical_line"></span>
        </div>
        <div class="item">
          品牌<span class="iconfont icon-xiala"></span
          ><span class="iconfont icon-vertical_line"></span>
        </div>
        <div class="item">特色<span class="iconfont icon-xiala"></span></div>
      </div>
    </div>
    <div class="cinema-list">
      <a
        href="javascrip:;"
        class="item mb-line-b link"
        v-for="item in cinema"
        :key="item.id"
      >
        <div class="cinema-item">
          <div class="title line-ellipsis">
            <span>{{ item.nm }}</span>
            <span class="price-block">
              <span class="price">{{ item.sellPrice }}</span>
              <span class="q">元起</span>
            </span>
          </div>
          <div class="location">
            {{ item.addr }}
          </div>
          <div class="label">
            <div class="allowRefund" v-if="item.tag.allowRefund == '1'">退</div>
            <div class="endorse" v-if="item.tag.endorse == '1'">改签</div>
            <div class="snack" v-if="item.tag.snack == '1'">小吃</div>
            <div class="vipTag" v-if="item.tag.vipTag != ''">
              {{ item.tag.vipTag }}
            </div>
            <div
              class="hallType"
              v-for="item in item.tag.hallType"
              :key="item.index"
            >
              {{ item }}
            </div>
          </div>
          <div class="discount-block">
            <div class="card" v-show="item.promotion.cardPromotionTag != ''">
              <img src="../../../assets/card.png" />
            </div>
            <div class="discount-label-text">
              {{ item.promotion.cardPromotionTag }}
            </div>
          </div>
        </div>
      </a>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: "Cinema",
  data() {
    return {
      // eslint-disable-next-line vue/no-dupe-keys
      cinema: [],
    };
  },
  mounted() {
    axios
      .get(
        "/ajax/moreCinemas?movieId=0&day=2022-04-08&offset=0&limit=20&districtId=-1&lineId=-1&hallType=-1&brandId=-1&serviceId=-1&areaId=-1&stationId=-1&item=&updateShowDay=true&reqId=1649350722579&cityId=30&optimus_uuid=8AF7E980B40211ECA7EB0543F3532A46FBA2CDE7D48844C4A5D5A08129DBA30E&optimus_risk_level=71&optimus_code=10"
      )
      .then((res) => {
        console.log(res);
        // eslint-disable-next-line vue/no-mutating-props
        this.cinema = res.data.cinemas.cinemas;
      });
  },
};
</script>

<style scoped lang="less">
.cinema {
  position: fixed;
  width: 100%;
  height: 41px;
  z-index: 10;
  background-color: #fff;
  color: #777;
  top: 142px;

  .tab {
    display: flex;
    background: url(../../../assets/ln-b.png) 0 bottom repeat-x;
    margin: 0 auto;
    width: 90%;
    text-align: center;

    .item {
      flex: 1;
      text-align: center;
      line-height: 41px;
      position: relative;
      white-space: nowrap;
      overflow: hidden;
      font-size: 10px;
      text-overflow: ellipsis;

      .icon-vertical_line {
        position: absolute;
        right: 0;
        font-size: 17px;
      }

      .icon-xiala {
        font-size: 17px;
      }
    }
  }
}

.cinema-list {
  padding-top: 40px;
  padding-left: 15px;
  background: #fff;
  padding-bottom: 40px;

  .item {
    margin-left: 20px;
    position: relative;
    overflow: hidden;
    color: #333;

    .cinema-item {
      align-items: center;
      display: block;
      background: url("../../../assets/ln-b.png") 0 bottom repeat-x;
      padding-bottom: 5px;
      .title {
        height: 24px;
        line-height: 24px;
        font-size: 16px;
        color: #000;

        .price-block {
          padding-top: 9px;
          padding-left: 3px;

          .price {
            font-size: 18px;
            color: #f03d37;
          }

          .q {
            font-size: 12px;
            color: #f03d37;
            margin-left: 3px;
          }
        }
      }

      .location {
        margin-top: 6px;
        font-size: 13px;
        color: #666;
        display: flex;
      }

      .label {
        height: 17px;
        line-height: 17px;
        margin-top: 4px;
        margin-bottom: 4px;
        overflow: hidden;
        font-size: 0;
        flex-shrink: 0;

        > div:not(:first-child) {
          margin-left: 0.1rem;
        }

        > div {
          position: relative;
          display: inline-block;
          padding: 0 3px;
          height: 15px;
          line-height: 15px;
          border-radius: 2px;
          font-size: 9px;
        }

        .allowRefund,
        .endorse,
        .hallType {
          color: #589daf;
          border: 1px solid #589daf;
        }

        .snack,
        .vipTag {
          color: #f90;
          border: 1px solid #f90;
        }
      }

      .discount-block {
        color: #999;
        margin-bottom: 4px;

        .card {
          width: 15px;
          height: 15px;
          position: relative;
          top: 3px;
          display: inline-flex;

          img {
            width: 100%;
          }
        }

        .discount-label-text {
          margin-left: 0;
          font-size: 12px;
          display: inline-block;
        }
      }
    }
  }
}
</style>